# Tanım: CUPS yazdırma sistemi
# URL: http://www.cups.org
# Paketçi: milisarge
# Gerekler: avahi python gnutls xdg-utils gtk-update-icon-cache
# Grup: sistem

isim=cups
surum=2.2.6
devir=1
kaynak=(https://github.com/apple/cups/archive/v$surum.tar.gz::$isim-$surum.tar.gz)

derle() {
	
	cd $isim-$surum
	sed -i 's:555:755:g;s:444:644:g' Makedefs.in
	sed -i '/MAN.*.EXT/s:.gz::g' \
	configure config-scripts/cups-manpages.m4
	sed -i '/LIBGCRYPTCONFIG/d' config-scripts/cups-ssl.m4
	aclocal -I config-scripts
	autoconf -I config-scripts	
	
	sed -i -e "\$aName[tr]=Yazıcı Yönetimi \nComment[tr]=CUPS için web arayüzü" desktop/cups.desktop.in

	./configure \
	--libdir=/usr/lib \
	--disable-systemd \
	--with-rcdir=/tmp/cupsinit \
	--with-system-groups=lpadmin \
	--with-docdir=/usr/share/cups/doc-$surum
	make
	make BUILDROOT=$PKG install

	rm -rf $PKG/tmp
	mkdir -p $PKG/usr/share/doc
	ln -svnf ../cups/doc-$surum $PKG/usr/share/doc/cups-$surum

	# masaüstü
	if [ ! -f $PKG/usr/share/applications/cups.desktop ]; then
		mkdir -p $PKG/usr/share/applications
		install -m644 desktop/cups.desktop \
		$PKG/usr/share/applications/cups.desktop
	fi
	# servis
	cd /sources/milis.git/ayarlar/servisler
	make DESTDIR=$PKG kur-cups 

	rm -rf $PKG/usr/share/cups/banners
	rm -rf $PKG/usr/share/cups/data/testprint

	chmod 755 $PKG/etc

	# PAM
	cat > $PKG/etc/pam.d/cups << "EOF"
# Begin /etc/pam.d/cups

auth    include system-auth
account include system-account
session include system-session

# End /etc/pam.d/cups
EOF
}
